package com.juc.threadPoolExecutor.threadPoolExecutor19;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Test {
/**
 * 接口Runnable在ThreadPoolExecutor的队列中按顺序取出，执行却是乱序的
 * @param args
 */
	public static void main(String[] args) {
		
		ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<Runnable>());
		for (int i = 0; i < 50; i++) {
			MyRunnable myRunnable =new MyRunnable("username" + (i+1));
			executor.execute(myRunnable);
		}
		
	}
}
